Update some build tools and libgit2
authorAlex Crichton <alex@alexcrichton.com>
Wed, 7 Oct 2015 18:26:14 +0000 (11:26 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 7 Oct 2015 18:33:39 +0000 (11:33 -0700)
* Updates git2-rs back to 0.3 now that the distribution issue on OSX has been
  fixed.
* Updates libgit2-sys to using the `cmake` crate so building with VS 2015 can
  work.
* Update pkg-config to totally disable it on MSVC (basically guaranteed to never
  work)

Cargo.lock
Cargo.toml
src/cargo/sources/git/utils.rs
tests/support/git.rs
tests/test_cargo_build_auth.rs
tests/test_cargo_compile_git_deps.rs

index 3f94ce0680bd5e617d037167a4e9ce17bb06878b..797fdf4faa1cfbbcf5c8fbf9014e649ef44d8b3f 100644 (file)
@@ -11,13 +11,13 @@ dependencies = [
  "env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "filetime 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "flate2 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "git2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
- "git2-curl 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "git2 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "git2-curl 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "glob 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "hamcrest 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "kernel32-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "libgit2-sys 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libgit2-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "num_cpus 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -61,7 +61,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "cmake"
-version = "0.1.3"
+version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "gcc 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -101,7 +101,7 @@ dependencies = [
  "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "libz-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "openssl-sys 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -153,22 +153,22 @@ dependencies = [
 
 [[package]]
 name = "git2"
-version = "0.2.14"
+version = "0.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "libgit2-sys 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libgit2-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "git2-curl"
-version = "0.2.4"
+version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "curl 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
- "git2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "git2 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -202,14 +202,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "libgit2-sys"
-version = "0.2.20"
+version = "0.3.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
+ "cmake 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "libssh2-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
  "libz-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "openssl-sys 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -225,11 +226,11 @@ name = "libssh2-sys"
 version = "0.1.30"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "cmake 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cmake 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "libz-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "openssl-sys 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -239,7 +240,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "gcc 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -297,12 +298,12 @@ dependencies = [
  "gcc 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "pkg-config"
-version = "0.3.5"
+version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
index 943e570a0c057e5f8ad8dc5573aef7011c36143a..7422dbad88d9ce3e316d37a197ef36810b5c0e2f 100644 (file)
@@ -25,12 +25,12 @@ docopt = "0.6"
 env_logger = "0.3"
 filetime = "0.1"
 flate2 = "0.2"
-git2 = "0.2"
-git2-curl = "0.2"
+git2 = "0.3"
+git2-curl = "0.3"
 glob = "0.2"
 kernel32-sys = "0.1"
 libc = "0.1"
-libgit2-sys = "0.2"
+libgit2-sys = "0.3"
 log = "0.3"
 num_cpus = "0.2"
 regex = "0.1"
index f51b9dc97b9f0bf3f6749ad89cb4a046c78b0d88..9973cd8a2bd630967175306005f01d8ddbd7355a 100644 (file)
@@ -427,10 +427,11 @@ pub fn fetch(repo: &git2::Repository, url: &str,
     with_authentication(url, &try!(repo.config()), |f| {
         let mut cb = git2::RemoteCallbacks::new();
         cb.credentials(f);
-        let mut remote = try!(repo.remote_anonymous(&url, Some(refspec)));
-        try!(remote.add_fetch("refs/tags/*:refs/tags/*"));
-        remote.set_callbacks(cb);
-        try!(remote.fetch(&["refs/tags/*:refs/tags/*", refspec], None));
+        let mut remote = try!(repo.remote_anonymous(&url));
+        let mut opts = git2::FetchOptions::new();
+        opts.remote_callbacks(cb)
+            .download_tags(git2::AutotagOption::All);
+        try!(remote.fetch(&[refspec], Some(&mut opts), None));
         Ok(())
     })
 }
index 082f07fab6a072d738e50690971774c6c7171ed3..a84e5287dee527e1b76a0c631893b2275aecd97d 100644 (file)
@@ -97,10 +97,9 @@ pub fn add_submodule<'a>(repo: &'a git2::Repository, url: &str,
     let path = path.to_str().unwrap().replace(r"\", "/");
     let mut s = repo.submodule(url, Path::new(&path), false).unwrap();
     let subrepo = s.open().unwrap();
+    subrepo.remote_add_fetch("origin", "refs/heads/*:refs/heads/*").unwrap();
     let mut origin = subrepo.find_remote("origin").unwrap();
-    origin.add_fetch("refs/heads/*:refs/heads/*").unwrap();
-    origin.fetch(&[], None).unwrap();
-    origin.save().unwrap();
+    origin.fetch(&[], None, None).unwrap();
     subrepo.checkout_head(None).unwrap();
     s.add_finalize().unwrap();
     return s;
index 0416c477cd80096e8a684bad1dcf91bc8dd70909..9dcf1293ce81dace079a26babc271149d9437907 100644 (file)
@@ -40,7 +40,7 @@ test!(http_auth_offered {
         assert_eq!(req, vec![
             "GET /foo/bar/info/refs?service=git-upload-pack HTTP/1.1",
             "Accept: */*",
-            "User-Agent: git/1.0 (libgit2 0.22.0)",
+            "User-Agent: git/1.0 (libgit2 0.23.0)",
         ].into_iter().map(|s| s.to_string()).collect());
         drop(s);
 
@@ -55,7 +55,7 @@ test!(http_auth_offered {
             "GET /foo/bar/info/refs?service=git-upload-pack HTTP/1.1",
             "Authorization: Basic Zm9vOmJhcg==",
             "Accept: */*",
-            "User-Agent: git/1.0 (libgit2 0.22.0)",
+            "User-Agent: git/1.0 (libgit2 0.23.0)",
         ].into_iter().map(|s| s.to_string()).collect());
     });
 
@@ -155,6 +155,8 @@ Caused by:
         addr = addr,
         errmsg = if cfg!(windows) {
             "[[..]] failed to send request: [..]\n"
+        } else if cfg!(target_os = "macos") {
+            "[[..]] unexpected return value from ssl handshake [..]"
         } else {
             "[[..]] SSL error: [..]"
         })));
index 3cf30a2f27edfeb3ef30f23aab8ceb78a0494f65..fcab5d846a33162811b60e9858c1971bb56e6bef 100644 (file)
@@ -931,12 +931,12 @@ test!(dep_with_changed_submodule {
     sub.sync().unwrap();
     {
         let subrepo = sub.open().unwrap();
+        subrepo.remote_add_fetch("origin",
+                                 "refs/heads/*:refs/heads/*").unwrap();
+        subrepo.remote_set_url("origin",
+                               &git_project3.url().to_string()).unwrap();
         let mut origin = subrepo.find_remote("origin").unwrap();
-        origin.set_url(&git_project3.url().to_string()).unwrap();
-        origin.add_fetch("refs/heads/*:refs/heads/*").unwrap();;
-        origin.fetch(&[], None).unwrap();
-        origin.save().unwrap();
-
+        origin.fetch(&[], None, None).unwrap();
         let id = subrepo.refname_to_id("refs/remotes/origin/master").unwrap();
         let obj = subrepo.find_object(id, None).unwrap();
         subrepo.reset(&obj, git2::ResetType::Hard, None).unwrap();